package com.dqx.haoqiu.repository.repository.news.remote;

import com.dqx.haoqiu.repository.api.NewsApi;
import com.dqx.haoqiu.repository.entity.NewsEntity;
import com.dqx.haoqiu.repository.repository.news.NewsSource;

import java.util.List;

import javax.inject.Inject;

import io.reactivex.Observable;

/**
 * 远程数据源：通过服务端来存取数据，可以结合网络请求框架使用
 */
public class NewsRemoteSource implements NewsSource {
    NewsApi api;

    @Inject
    public NewsRemoteSource(NewsApi api) {
        this.api = api;
    }

    @Override
    public Observable<List<NewsEntity>> getNews(int channel, int page, int page_size, long currentTime, int category) {
        return api.getNews(channel, page, page_size, currentTime, category);
    }
}